import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';

class PeiwanInfo extends StatefulWidget {
  bool isOnline;
  int gender;
  String name;
  int age;
  int height;
  double distance;
  List lables;
  AssetImage image;

  PeiwanInfo(this.isOnline, this.gender, this.name, this.age, this.height,
      this.distance, this.lables, this.image);

  @override
  State<StatefulWidget> createState() {
    return _PeiwanInfoState();
  }
}

class _PeiwanInfoState extends State<PeiwanInfo> {
  @override
  Widget build(BuildContext context) {
    return Container(
        child: Column(
      children: [
        Stack(
          children: [
            Container(
                clipBehavior: Clip.hardEdge,
                decoration: BoxDecoration(
                    borderRadius: BorderRadius.all(Radius.circular(10))),
                child: Image(
                  image: widget.image,
                  fit: BoxFit.cover,
                )),
            Container(
              child: Text(widget.isOnline ? "在线" : "离线",style: TextStyle(color: Colors.white),),
            )
          ],
        ),
        Expanded(
          child: Row(
            crossAxisAlignment: CrossAxisAlignment.center,
            children: [
              Text(widget.name,style: TextStyle(fontSize: 10),),
              Text("${widget.age}",style: TextStyle(fontSize: 10),),
              Image.asset("images/location_icon.png"),
              Text("${widget.distance}km",style: TextStyle(fontSize: 10),)
            ],
          ),
        ),
        Row(
          mainAxisAlignment: MainAxisAlignment.spaceEvenly,
          children: List.generate(widget.lables.length, (index) {
            return Container(
              decoration: BoxDecoration(color: Colors.lightBlue),
              child: Text(
                widget.lables[index],
                style: TextStyle(fontSize: 10),
              ),
            );
          }),
        ),
      ],
    ));
  }
}
